<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>美嘉饲料</title>
<link href="<%=basePath%>skin/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=basePath%>skin/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="<%=basePath%>skin/js/common.js"></script>
<script type="text/javascript">
	$().ready(function(){
		$("#menu_order").attr("class","select");
		var orderStatus = "${order.orderStatus}";
		var paymentStatus = "${order.paymentStatus}";
		var shippingStatus = "${order.shippingStatus}";
		if (orderStatus == 1 && paymentStatus == 2 && shippingStatus == 2 ) {
			$("#jindu").attr("src","<%=basePath%>skin/images/hedui.png");
			$("#step_2").attr("class","hongzi");
		}
		
		if (orderStatus == 2 ) {
			$("#jindu").attr("src","<%=basePath%>skin/images/disanbu.png");
			$("#step_2").attr("class","hongzi");
			$("#step_3").attr("class","hongzi");
		}
		var $cancel = $("#cancel");
		var id = $("#id").val();
		$cancel.click(function(){
			if(confirm("确定要去取消订单吗?")) {
				$.ajax({
					url: "<%=basePath%>member/order/cancel.shtml",
					type: "POST",
					data: {id: id},
					cache: false,
					beforeSend: function() {
						$cancel.prop("disabled", true);
					},
					success: function(data) {
						var success = data.success;
						if (success == "true") {
							alert("订单取消成功");
						} else {
							alert("订单取消失败");
						}
						location.reload(true);
					},
					complete: function() {
						$cancel.prop("disabled", false);
					}
				});
			}
			return false;
		});
	});
</script>
</head>
  
<body>
<div class="nb-smt"></div>
<div id="container" class="wkg">
<c:import url="/layouts/top.jsp" />
<div id="content">
        <c:import url="/layouts/head.jsp" />
        <div id="main">
        	<c:import url="../left.jsp" />
			<div id="myRight">
			<div class="myRightTitle">
				<div class="mrtl">
					订单详情
				</div>
				<div class="mrtr">
					<div class="diyibu" style="line-height:20px;padding-top:10px;">
					<img id="jindu" src="<%=basePath%>skin/images/diyibu.png" /><br/>
					<span id="step_1" class="hongzi" style="font-size:12px;">提交订单</span>　 
					<span id="step_2" class="xiaohui" style="font-size:12px;">商品出库</span>　
					<span id="step_3" class="xiaohui" style="font-size:12px;">收货完成</span>
					</div>
				</div>
				<div class="clear"></div>
			</div>
			<div class="myRightContent">
				<div id="my1">
					<div id="my1Top">
						<input type="hidden" id="id" name="id" value="${order.id}"/>
						订单号：${order.sn }&nbsp;&nbsp;订单状态：${order.orderStatusLabel }
						<div id="my1TopRight">
						</div>
					</div>
					<div id="my1Center">
						<div id="my1Other">
							创建日期：<fmt:formatDate value="${order.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/><br/>
							支付方式：${order.paymentMethodName}<br/>
							配送方式：${order.shippingMethodName}<br/>
							订单金额：<fmt:formatNumber value="${order.amount}" pattern="0.00"/><br/>
							发票抬头：${order.invoiceTitle }<br/>
							收货人：${order.consignee }<br/>
							邮编：${order.zipCode }<br/>
							地址：${order.address }<br/>
							电话：${order.phone }
						</div>
						<table id="my1Table" cellspacing="0" cellpadding="0">
							<thead>
								<td>商品</td>
								<td>单价</td>
								<td>数量</td>
								<td>小计</td>
							</thead>
							<tbody>
							<c:forEach items="${order.orderItems }" var="orderItem">
								<tr>
									<td>${orderItem.name }</td>
									<td><fmt:formatNumber value="${orderItem.price }" pattern="0.00"/></td>
									<td><fmt:formatNumber value="${orderItem.quantity }" pattern="0"/></td>
									<td><fmt:formatNumber value="${orderItem.subtotal }" pattern="0.00"/></td>
								</tr>
							</c:forEach>							
							</tbody>
						</table>
					</div>
				</div>
			</div>
			</div>
        </div>
        <div class="clear"></div>
    </div>
</div>
<c:import url="/layouts/foot.jsp" />
</body>
</html>


